<template>
    <el-card class="box-card">
        <div class="space20">
</div>
        <div slot="header" class="clearfix">
            <span style="line-height: 36px;">{{type}}</span>
            <el-button type="primary" style="float:right;margin:0 10px;" v-show="type=='保存' || type=='提交'|| type=='新增'" @click="save('保存')">保存</el-button>
            <el-button type="primary" style="float:right;margin:0 10px;" v-show="!(type=='退保申请' || type=='退保审核'|| type=='退保修改'|| type=='退保确认' || type=='保单查看')"  @click="save('提交')">提交</el-button>
            <!-- <el-button type="primary" style="float:right;margin:0 10px;" v-show="type=='修改'">修改</el-button> -->
        </div>
        <!-- 保险单信息 组件 -->
        <el-tabs type="border-card">
            <el-tab-pane label="询问事项">
                <ask :Ftype="type" ref="ask">
                </ask>
            </el-tab-pane>
            <el-tab-pane label="产品信息">
                <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <span style="line-height: 36px;">被保险人信息</span>
                    </div>
                    <el-form ref="form" :model="form" class="demo-form-inline">
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="姓名" label-width="120px">
                                    <el-input v-model="form.CUSTOM_NAME" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="留学国家" label-width="280px">
                                    <el-input v-model="form.CUSTOM_SCOUNTRY" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>

                        </el-row>

                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="性别" label-width="120px">
                                    <el-select v-model="form.CUSTOM_SEX" placeholder="请选择性别" :disabled="!(type=='新增' || type=='修改' || type=='提交')" > 
                                        <el-option label="男" value="男"></el-option>
                                        <el-option label="女" value="女"></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="留学目的地国家或地区教育机构名称" label-width="280px">
                                  <el-input v-model="form.CUSTOM_SCHOOL" :disabled="true"></el-input>                               
                                     <el-button type="primary" @click="ChooseSchool" :disabled="!(type=='新增' || type=='修改' || type=='提交')" >选择</el-button> 
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="出生日期" label-width="120px">
                                    <el-date-picker type="date" placeholder="选择日期" v-model="form.CUSTOM_BIRTHDATE" @input="moneyComputer" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="入学通知书或教育机构的申请确认编码" label-width="280px">
                                    <el-input v-model="form.CUSTOM_CODE" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="护照号码" label-width="120px">
                                    <el-input v-model="form.CUSTOM_PASSPORT" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="境外邮编" label-width="280px">
                                    <el-input v-model="form.CUSTOM_OZIP" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="国籍" label-width="120px">
                                    <el-input v-model="form.CUSTOM_COUNTRY" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="境外通讯地址" label-width="280px" >
                                    <el-input v-model="form.CUSTOM_OADDRESS"  type="textarea" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="联系电话" label-width="120px">
                                    <el-input v-model="form.CUSTOM_TEL" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>

                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="电子邮箱" label-width="120px">
                                    <el-input v-model="form.CUSTOM_EMAIL" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>

                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="境内邮编" label-width="120px">
                                    <el-input v-model="form.CUSTOM_ZIP" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="境内常住地址" label-width="120px"  >
                                    <el-input v-model="form.CUSTOM_ADDRESS" type="textarea" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-card>
                <div class="space20">
                </div>
                <el-card>
                    <div slot="header" class="clearfix">
                        <span style="line-height: 36px;">投保人信息</span>
                    </div>
                    <div class="form-item">是否与被保险人为同一人
                        <el-radio class="radio" v-model="saleDetail.SALESDETAIL_ISINSURED" label="是" :disabled="!(type=='新增' || type=='修改' || type=='提交')">是</el-radio>
                        <el-radio class="radio" v-model="saleDetail.SALESDETAIL_ISINSURED" label="否" :disabled="!(type=='新增' || type=='修改' || type=='提交')">否</el-radio>
                    </div>
                    <relation-people ref="prople1" :type="'投保人'" :Ftype="type" v-show="saleDetail.SALESDETAIL_ISINSURED=='否'" >
                    </relation-people>
                </el-card>
                <div class="space20">
                </div>
                <el-card>
                    <div slot="header" class="clearfix">
                        <span style="line-height: 36px;">关键联络人信息</span>
                    </div>
                    <div class="form-item">是否与投保人为同一人
                        <el-radio class="radio" v-model="saleDetail.SALESDETAIL_ISHOLDER" label="是"  :disabled="saleDetail.SALESDETAIL_ISINSURED=='是' || !(type=='新增' || type=='修改' || type=='提交')">是</el-radio>
                        <el-radio class="radio" v-model="saleDetail.SALESDETAIL_ISHOLDER" label="否" :disabled="!(type=='新增' || type=='修改' || type=='提交')">否</el-radio>
                    </div>
                    <relation-people ref="prople2"  :type="'关键联络人'" :Ftype="type"  v-show="saleDetail.SALESDETAIL_ISHOLDER=='否'">
                    </relation-people>
                </el-card>
                <div class="space20">
                </div>
                <el-card>
                    <div slot="header" class="clearfix">
                        <span style="line-height: 36px;">受益人信息</span>
                    </div>
                    <div class="form-item">
                        <el-radio class="radio" v-model="saleDetail.SALESDETAIL_ISBENEFICIARY" label="非法定受益人" :disabled="!(type=='新增' || type=='修改' || type=='提交')">非法定受益人</el-radio>
                        <el-radio class="radio" v-model="saleDetail.SALESDETAIL_ISBENEFICIARY" label="法定受益人" :disabled="!(type=='新增' || type=='修改' || type=='提交')">法定受益人
                        </el-radio>
                    </div>
                    <div class="form-item">除另有指定外，本保险各项医疗、学业中断及全球紧急救援保险金（身故、遗体运返及安葬保险金除外）的受益人为被保险人本人。
                    </div>
                    <el-row :gutter="10" v-show="saleDetail.SALESDETAIL_ISBENEFICIARY=='非法定受益人'">
                        <el-col :span="3" style="font-size:14px; line-height:35px; text-align:right">
                            受益人个数:
                        </el-col>
                        <el-col :span="4">
                            <el-input v-model="saleDetail.FAVOREEs.length" placeholder="受益人个数" :disabled="true"></el-input>
                        </el-col>
                        <el-col :span="6">
                            <el-button type="primary" @click="beneficiary" :disabled="!(type=='新增' || type=='修改' || type=='提交')">新增</el-button>                          
                        </el-col>

                    </el-row>
                    <div class="space20">
                    </div>
                    <beneficiary-list v-show="saleDetail.SALESDETAIL_ISBENEFICIARY=='非法定受益人'">
                    </beneficiary-list>
                </el-card>
                <div class="space20">
                </div>
                <el-card>
                    <div slot="header" class="clearfix">
                        <span style="line-height: 36px;">保单明细</span>
                    </div>
                    <el-form>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="保险购买日期" label-width="100px">
                                      <el-date-picker
                                     v-model="saleDetail.SALESDETAIL_APPLYTIME" type="date" placeholder="选择保险购买日期" :disabled="!(type=='新增' || type=='修改' || type=='提交')" >
                                     </el-date-picker>                                   
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="产品类型" label-width="100px">
                                    <el-select v-model="saleDetail.PRODUCE_ID" placeholder="产品类型"  @input="moneyComputer" :disabled="!(type=='新增' || type=='修改' || type=='提交')">
                                        <el-option :label="item.PRODUCE_INAME" :value="item.PRODUCE_ID" :key="item.PRODUCE_ID" v-for="item in produceList"></el-option>
                                      
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row>

                            <el-col :span="12">
                                <el-form-item label="保险生效日期" label-width="100px">
                                     <el-date-picker
                                     v-model="saleDetail.SALESDETAIL_STARTTIME" type="date" placeholder="选择保险生效日期" :disabled="!(type=='新增' || type=='修改' || type=='提交')"  @input="moneyComputer" >
                                     </el-date-picker>
                                
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="保险到期日期" label-width="100px">
                                      <el-date-picker
                                     v-model="saleDetail.SALESDETAIL_ENDTIME" type="date" placeholder="选择保险到期日期" :disabled="!(type=='新增' || type=='修改' || type=='提交')"  @input="moneyComputer" >
                                     </el-date-picker>                                   
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>

                            <el-col :span="12">
                                <el-form-item label="保障期间" label-width="100px">
                                       <el-input v-model="saleDetail.SALESDETAIL_RANGE"  :disabled="true"></el-input>                                   
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="附加保险责任" label-width="100px" >
                                    <el-select v-model="saleDetail.SALESDETAIL_ADDITION" placeholder="附加保险责任" :disabled="!(type=='新增' || type=='修改' || type=='提交')">
                                        <el-option label="意外伤害" value="意外伤害"></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="应付保费" label-width="100px">
                                    <el-input v-model="saleDetail.SALESDETAIL_MONEY"  :disabled="true"></el-input>
                                </el-form-item>
                            </el-col>

                            <el-col :span="12">
                                <el-form-item label="增额应付保费" label-width="100px">
                                    <el-input v-model="saleDetail.SALESDETAIL_ADDMONEY" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>

                        </el-row>
                         <el-row>
                            <el-col :span="12">
                                <el-form-item label="新增保额" label-width="100px">
                                    <el-input v-model="saleDetail.SALESDETAIL_PRODUCEMONEY"  :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                                </el-form-item>
                            </el-col>                         

                        </el-row>
                        
                        <el-form-item label="特别约定" label-width="100px">
                            <el-input type="textarea" v-model="saleDetail.SALESDETAIL_CONTENT" :disabled="!(type=='新增' || type=='修改' || type=='提交')"></el-input>
                        </el-form-item>
                    </el-form>

                </el-card>
                <div class="space20">
                </div>
                <el-card>
                    <div slot="header" class="clearfix">
                        <span style="line-height: 36px;">上传文件</span>
                    </div>
                    <el-form :inline="true" class="demo-form-inline" label-position="right" label-width="300px">

                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="被保险人护照">
                                     <div class="el-button fileselect el-button--primary" v-if="type=='新增'|| type=='修改'|| type=='提交'">
                                        <input type="file" @change="upload('SALESDETAIL_PASSPORTDOC',$event,1)" value="" id="fileup1"> 上传附件
                                    </div>
                                    <el-button type='primary' @click="dowload('SALESDETAIL_PASSPORTDOC')" v-else>
                                        下载
                                    </el-button>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="入学通知书">
                                    <div class="el-button fileselect el-button--primary" v-if="type=='新增'|| type=='修改'|| type=='提交'">
                                        <input type="file" @change="upload('SALESDETAIL_CODEDOC',$event,2)" value="" id="fileup2"> 上传附件
                                    </div>
                                    <el-button type='primary' @click="dowload('SALESDETAIL_CODEDOC')" v-else>
                                        下载
                                    </el-button>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="投保人证件">
                                    <div class="el-button fileselect el-button--primary" v-if="type=='新增'|| type=='修改'|| type=='提交'">
                                        <input type="file" @change="upload('SALESDETAIL_HOLDERDOC',$event,3)" value="" id="fileup3"> 上传附件
                                    </div>
                                    <el-button type='primary' @click="dowload('SALESDETAIL_HOLDERDOC')" v-else>
                                        下载
                                    </el-button>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="受益人证件">
                                   <div class="el-button fileselect el-button--primary" v-if="type=='新增'|| type=='修改'|| type=='提交'">
                                        <input type="file" @change="upload('SALESDETAIL_BENEFICIARYDOC',$event,4)" value="" id="fileup4"> 上传附件
                                    </div>
                                    <el-button type='primary' @click="dowload('SALESDETAIL_BENEFICIARYDOC')" v-else>
                                        下载
                                    </el-button>                                    
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row v-if="type=='保单查看'">
                            <el-col :span="12">
                                <el-form-item label="保单">                                   
                                    <el-button type='primary' @click="dowload('SALESDETAIL_DOC')">
                                        下载
                                    </el-button>
                                </el-form-item>
                            </el-col>                            
                        </el-row>

                    </el-form>
                </el-card>
            </el-tab-pane>

            <el-dialog title="新增受益人" :visible.sync="beneficiaryShow" v-if="beneficiaryShow"  :modal="type=='新增'">
                <beneficiary @close="close">
                </beneficiary>
            </el-dialog>
            <el-dialog title="选择学校"  :modal="type=='新增'" :visible.sync="SchoolShow" v-if="SchoolShow">
                <school-select @SelctSchool="SelctSchool">
      </school-select>
    </el-dialog>
        </el-tabs>
    </el-card>
</template>
<script>
import { mapState } from "vuex";
import relationPeople from "@/components/Sell/policy/relationPeople";
import beneficiaryList from "@/components/Sell/policy/beneficiaryList";
import beneficiary from "@/components/Sell/policy/beneficiary";
import ask from "@/components/Sell/policy/ask";
import api from "@/js/api";
import getid from "@/js/getid";
import price from "@/js/price";
import SchoolSelect from "@/components/Crm/SchoolSelect";
export default {
  data() {
    return {
      SchoolShow: false, //选择学校
      form: {
        CUSTOM_ID: "",
        CUSTOM_NAME: "",
        CUSTOM_LEVEL: "",
        CUSTOM_STATE: "",
        CUSTOM_SEX: "",
        CUSTOM_COUNTRY: "",
        CUSTOM_BIRTHDATE: "",
        CUSTOM_SCOUNTRY: "",
        CUSTOM_PASSPORT: "",
        CUSTOM_ZIP: "",
        CUSTOM_TEL: "",
        CUSTOM_SCHOOL: "",
        CUSTOM_EMAIL: "",
        CUSTOM_CODE: "",
        CUSTOM_OZIP: "",
        CUSTOM_ADDRESS: "",
        CUSTOM_OADDRESS: "",
        CUSTOM_PRODUCE: "",
        ORGANIZATION_ID: "", //无渠道
        ADMIN_ID: "",
        CUSTOM_ENDTIME: "",
        CUSTOM_ADDTIME: "",
        ORGANIZATION: [],
        CUSTOM_SCHOOLID: "",
        CUSTOM_SCHOOL: "",
        CUSTOM_ISSEALD:''
      },
      beneficiaryShow: false,
      produceList: []
    };
  },
  computed: mapState({
    saleDetail: state => state.SealDetail.model
  }),
  props: {
    type: {
      type: String,
      default: "新增" // 新增、修改、提交(保存未提交)、购买(从客户列表点击购买)
    }
  },
  components: {
    "relation-people": relationPeople,
    "beneficiary-list": beneficiaryList,
    "school-select": SchoolSelect,
    beneficiary: beneficiary,
    ask: ask
  },
  methods: {
    //选择受益人
    beneficiary() {
      this.beneficiaryShow = true;
    },
    ChooseSchool() {
      this.SchoolShow = true;
    },
    //选择学校
    SelctSchool(val) {
      this.SchoolShow = false;
      this.form.CUSTOM_SCHOOLID = val.SCHOOL_ID;
      this.form.CUSTOM_SCHOOL = val.SCHOOL_NAME;
    },
    //关闭 受益人输入
    close() {
      this.beneficiaryShow = false;
    },
    //保存
    save(name) {
      //如果是新增 用户
    //   console.log(this.saleDetail);
      if (this.type == "新增" || this.type == "提交" || this.type == "修改") {
        if (name == "保存") {
          this.saleDetail.SALESDETAIL_CHECKSTATE = "未提交";
        } else {
          this.saleDetail.SALESDETAIL_CHECKSTATE = "客户信息审核"; //未提交 客户信息审核 需上传投保单 投保单审核 需缴费确认 需到账确认 需保险单上传
        }
      }
    
      if(this.type=="客户信息审核" || this.type=="投保单审核"){

      }

      if (this.type == "新增") {
        //所属用户
        this.form.CUSTOM_ISSEALD = "已购买";
        this.form.CUSTOM_ADDTIME=new Date();
        if (!this.form.CUSTOM_ID) {
          this.form.CUSTOM_ID = getid.getid(); //id
          this.form.ADMIN_ID = sessionStorage.getItem("userId");
        }
        this.saleDetail.CUSTOM_ID = this.form.CUSTOM_ID;
        this.saleDetail.SALESDETAIL_ID = getid.getid();
        this.saleDetail.SALESDETAIL_SALESTIME = new Date();
        for (var i = 0; i < this.saleDetail.FAVOREEs.length; i++) {
          this.saleDetail.FAVOREEs[
            i
          ].SALESDETAIL_ID = this.saleDetail.SALESDETAIL_ID;
        }
       
        var data = {
          SALESDETAIL: this.saleDetail,
          CUSTOM: this.form
        };
        api.SaledetailAddDto(this, data);
      } else {
        for (var i = 0; i < this.saleDetail.FAVOREEs.length; i++) {
          this.saleDetail.FAVOREEs[
            i
          ].SALESDETAIL_ID = this.saleDetail.SALESDETAIL_ID;
        }
        var data = {
          SALESDETAIL: this.saleDetail,
          CUSTOM: this.form
        };
        api.SaledetailUpdate(this, data);
      }
    },
    //提交
    comunit() {},
    //计算保险金额 和保险区间
    moneyComputer() {
      if (
        this.saleDetail.SALESDETAIL_ENDTIME &&
        this.saleDetail.SALESDETAIL_STARTTIME
      ) {
        var timeSpan = getid.getMonthDay(
          this.saleDetail.SALESDETAIL_STARTTIME,
          this.saleDetail.SALESDETAIL_ENDTIME
        );
        if (timeSpan == 0) {
          return;
        }
        var bili = 0;
        var isYear = false; //是否是整年
        if (timeSpan > 31) {
          //获取 比例
          var mothSpan = timeSpan - 31;
          for (var i = 0; i < price.bili.length; i++) {
            if (mothSpan == price.bili[i].name) {
              bili = price.bili[i].value;
              break;
            }
          }
          if (mothSpan == 12) {
            isYear = true;
          }
          //计算区间
          this.saleDetail.SALESDETAIL_RANGE = timeSpan - 31 + "个月";
        } else {
          if (timeSpan <= 20) {
            bili = timeSpan;
          } else {
            bili = 20;
          }
          this.saleDetail.SALESDETAIL_RANGE = timeSpan + "天";
        }

        //如果出生年月 和套餐不为空
        if (this.form.CUSTOM_BIRTHDATE && this.saleDetail.PRODUCE_ID) {
          //获取产品名称
          var Pname = "";
          for (var i = 0; i < this.produceList.length; i++) {
            if (this.saleDetail.PRODUCE_ID == this.produceList[i].PRODUCE_ID) {
              Pname = this.produceList[i].PRODUCE_WNAME;
              break;
            }
          }
          this.saleDetail.PRODUCE_NAME = Pname;
          //客户推荐套餐
          this.form.CUSTOM_PRODUCE = Pname;
          //计算年龄
          var old = getid.getOld(this.form.CUSTOM_BIRTHDATE,this.saleDetail.SALESDETAIL_STARTTIME);
          //保存年龄
          this.saleDetail.SALESDETAIL_OLD = old;
          var priceArry = price.price;
          //获取年龄报价
          var AllPrice = 0;
          for (var i = 0; i < priceArry.length; i++) {
            if (old >= priceArry[i].min && old <= priceArry[i].max) {
              for (var k = 0; k < priceArry[i].content.length; k++) {
                if (Pname == priceArry[i].content[k].name) {
                  AllPrice = priceArry[i].content[k].price;
                  //是否 是一年 并且是畅游
                  if (isYear && Pname.indexOf("畅游") > 0) {
                    this.saleDetail.SALESDETAIL_MONEY = Math.round(
                      AllPrice * bili / 100 + price.yearAdd
                    );
                  } else {
                    this.saleDetail.SALESDETAIL_MONEY = Math.round(
                      AllPrice * bili / 100
                    );
                  }
                  return;
                }
              }
            }
          }
        } else {
          if (!this.form.CUSTOM_BIRTHDATE) {
            this.$notify.warning({
              title: "警告",
              message: "投保人出生日期为空"
            });
          } else {
            this.$notify.warning({
              title: "警告",
              message: "购买产品为空"
            });
          }
        }
      }
    },
    //获取产品列表
    getProduceList() {
      let that = this;
      var data = {
        pageIndex: 1,
        pageSize: 24
      };
      api.PRODUCEGetList(that, data, function(msg) {
        that.produceList = msg.Result;
      });
    },
    //文件上传
    upload(name, event, id) {
      let file = event.target.files[0];
      if (file) {
        const formData = new FormData();
        formData.append("file", file);
        let that = this;
        api.uploadFile(this, formData, function(msg) {
          eval(document.getElementById("fileup" + id)).value = "";
          that.saleDetail[name] = msg.Result.FilesList[0];
        //   console.log(that.saleDetail);
        });
      }
    },
    dowload(name) {
      var url = this.saleDetail[name];
      window.open(api.download(url));
      //   console.log(url);
    }
  },
  created() {
    // console.log(this.type);
    this.getProduceList();
    if (this.type == "新增") {
      //新增 置空
      this.$store.commit("changer", {});
    //   console.log(sessionStorage.getItem("custom"));
      if (sessionStorage.getItem("custom")) {
        this.form = JSON.parse(sessionStorage.getItem("custom"));
      }
    } else {
      this.form = this.saleDetail.CUSTOM;
    }
  }
};
</script>

<style scoped>
.form-item {
  font-size: 14px;
  margin-bottom: 22px;
}

.form-item input {
  display: inline-block;
  width: 200px;
}
.address input {
  max-width: 300px !important;
}

.el-input {
  max-width: 250px !important;
}
</style>
